
const downloadFile = (url, data, name = "文件下载") => {
  // 将对象转换为params
  const params = new URLSearchParams();
  Object.keys(data).forEach((key) => {
    params.append(key, data[key]);
  });
  const a = document.createElement("a");
  a.href = url + "?" + params.toString();
  a.download = name;
  a.click();
};

export { downloadFile };
